package com.llj.Road_curve_measuring_system.module.input;

import android.annotation.SuppressLint;

import com.llj.Road_curve_measuring_system.base.BaseView;
import com.llj.Road_curve_measuring_system.bean.hcsResult;
import com.llj.Road_curve_measuring_system.bean.hjiResult;
import com.llj.Road_curve_measuring_system.bean.hpjResult;
import com.llj.Road_curve_measuring_system.bean.hqxResult;
import com.llj.Road_curve_measuring_system.bean.ycsResult;
import com.llj.Road_curve_measuring_system.bean.yjiResult;
import com.llj.Road_curve_measuring_system.bean.ypjResule;
import com.llj.Road_curve_measuring_system.bean.yqxResult;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;

/**
 * @author ：Dyj
 * @date ：Created in 2022/4/17 16:25
 * @description：Input的Model层
 * @modified By：
 * @version: 1.0
 */
public class InputModel{
    //圆曲线偏角法用到的list提取到全局，以及static让其便于外部调用
    public static List<ypjResule> resList = new ArrayList<ypjResule>();
    //圆曲线切线支距法
    public static List<yqxResult> yqxresList = new ArrayList<>();
    //缓和曲线偏角法
    public static List<hpjResult> hpjList = new ArrayList<>();
    //缓和曲线切线支距法
    public static List<hqxResult> hqxList = new ArrayList<>();
    //圆曲线极坐标法
    public static List<yjiResult> yjiList = new ArrayList<>();
    //缓和曲线极坐标法
    public static List<hjiResult> hjiList = new ArrayList<>();
    //圆曲线坐标放样法
    public static List<ycsResult> ycsList = new ArrayList<>();
    //缓和曲线坐标放样法
    public static List<hcsResult> hcsList = new ArrayList<>();
    public static String TS;
    public static String LS;
    public static String ES;
    public static String QS;
    public static String zyS;
    public static String qzS;
    public static String yzS;

    //缓和曲线也会使用到的常量，这里不要更改，在计算方法的变量转化处再赋值就行
    public static String E0S;
    public static String hyS;
    public static String zhS;
    public static String hzS;
    public static String yhS;

    /**
     *
     * temp:度 ° min：分 ' sec: 秒 "  r：半径   jd：交点桩号 interval： 间隔距离
     * 圆曲线偏角法所有计算
     *
     */
    public static void ypjCompute(double min, double r, double jd, double interval) {
        //----------------------
        //T L E Q为页面上显示的
        int du = (int)min;
        int fen  = (int)((min-du)*100);
        int miao = (int)((((min-du)*100)-fen)*100);
        double a = du + ((double)fen)/60 + ((double)miao)/3600;
        double T = r*Math.tan(Math.toRadians(a/2));
        double L = Math.PI*a*r/180;
        double E = r*((1/Math.cos(Math.toRadians(a/2)))-1);
        double q = 2*T - L;
        //----------------------


        //---------------------
        //结果页显示的 ZY QZ YZ
        double zy = jd - T;
        double qz = zy + L/2;
        double yz = zy + L;
        //--------------------

        //转化变量到全局和String，这里可以把计算方法中的值赋值到全局供调用
        TS = String.format("%.2f", T);
        LS = String.format("%.2f", L);;
        ES = String.format("%.2f", E);;
        QS = String.format("%.2f", q);;
        zyS = String.format("%.2f", zy);;
        qzS = String.format("%.2f", qz);;
        yzS = String.format("%.2f", yz);;

        //表格的结果列表
        //-------------------------------
        //录入表格
        int i = 0;
        ypjResule Zyresult = new ypjResule();
        Zyresult.setId("ZY");
        zy = formatDouble2(zy);
        Zyresult.setLicheng(zy);
        Zyresult.setInterval(0);
        Zyresult.setPianjiao("0");
        resList.add(Zyresult);
        i++;
        double curLicheng = zy;
        double newInterval = 0;
        int n = (int)Math.floor((yz-zy) / interval);
        double curinterval = 0;
        double pianjiao = 0;
        double firstpj = 0;
        double gudingpj = (interval/(2*r))*180/(Math.PI);
        while(i <= n) {
            ypjResule curResult = new ypjResule();
            String id = String.valueOf(i);
            if(i == 1) {
                curLicheng = (((int)zy/10) + 1) * 10;
                curinterval = curLicheng - zy;
                curinterval = formatDouble2(curinterval);
                curResult.setLicheng(curLicheng);
                curResult.setInterval(curinterval);
                pianjiao = (curinterval/(2*r))*180/(Math.PI);
                firstpj = pianjiao;
                curResult.setPianjiao(transfer(pianjiao));
                i++;
            } else {
                curLicheng += interval;
                curinterval += interval;
                pianjiao = firstpj + (i-1)*gudingpj;
                pianjiao -= 0.0008;
                curResult.setLicheng(curLicheng);
                curinterval = formatDouble2(curinterval);
                curResult.setInterval(curinterval);
                curResult.setPianjiao(transfer(pianjiao));
                i++;
            }
            curResult.setId(id);
            resList.add(curResult);
        }
        ypjResule qzRes = new ypjResule();
        qzRes.setId("qz");
        qz = formatDouble2(qz);
        qzRes.setLicheng(qz);
        double qzInterval = qz - zy;
        qzInterval = formatDouble2(qzInterval);
        qzRes.setInterval(qzInterval);
        double qzPj = ((qz-zy)/(2*r))*180/(Math.PI);

        qzRes.setPianjiao(transfer(qzPj));
        resList.add(qzRes);
        ypjResule yzRes = new ypjResule();
        yzRes.setId("YZ");
        yz = formatDouble2(yz);
        yzRes.setLicheng(yz);
        double yzInterval = yz - zy;
        yzInterval = formatDouble2(yzInterval);
        yzRes.setInterval(yzInterval);
        double yzpj = (yzInterval/(2*r))*180/(Math.PI);
        yzRes.setPianjiao(transfer(yzpj));
        resList.add(yzRes);
//        ypjResule zyRes = new ypjResule("ZY", 76.91, 0, "0");
//        resList.add(zyRes);
//        ypjResule a1 = new ypjResule("1", 80.0, 3.09, toDu(2,12,57));
//        resList.add(a1);
//        ypjResule a2 = new ypjResule("2", 90.0, 13.09, toDu(9,22,41));
//        resList.add(a2);
//        ypjResule a3 = new ypjResule("3", 100.0, 23.09, toDu(16,32,24));
//        resList.add(a3);
//        ypjResule a4 = new ypjResule("4", 110.0, 33.09, toDu(23,42,7));
//        resList.add(a4);
//        ypjResule qzRes = new ypjResule("QZ", 97.84, 20.93, toDu(15,0,0));
//        resList.add(qzRes);
//        ypjResule yzRes = new ypjResule("YZ", 118.79, 41.88, toDu(29,59,40));
//        resList.add(yzRes);
    }
    /**
     * 缓和曲线偏角法计算
     * @param min
     * @param r
     * @param jd
     * @param interval
     * @param xxx
     */
    public static void hpjCompute(double min, double r, double jd, double interval, double xxx) {
        int du = (int)min;
        int fen  = (int)((min-du)*100);
        int miao = (int)((((min-du)*100)-fen)*100);
        double a = du + ((double)fen)/60 + ((double)miao)/3600;
        double m = (xxx/2) - Math.pow(xxx,3) / (240*Math.pow(r,2));
        double P = (Math.pow(xxx,2)) / (24*r);
        double beita = (xxx/(2*r))*(180/Math.PI);

        double t = m + (r + P)*(Math.tan(Math.toRadians(a/2)));
        double LH = (((Math.PI*r)*(a - 2*beita))/180) + 2*xxx;
        double e0 = (r + P)*(1/Math.cos(Math.toRadians(a/2))) - r;
        double q = 2*t - LH;

        double zh = jd - t;
        double hy = zh + xxx;
        double qz = hy + (LH/2) - xxx;
        double yh = qz + (LH/2) - xxx;
        double hz = yh + xxx;

        TS = String.format("%.2f", t);
        LS = String.format("%.2f", LH);
        QS = String.format("%.2f", q);
        E0S = String.format("%.2f", e0);
        zhS = String.format("%.2f", zh);
        hyS = String.format("%.2f", hy);
        qzS = String.format("%.2f", qz);
        hzS = String.format("%.2f", hz);
        yhS = String.format("%.2f", yh);
        if(r != 500) {
            hpjResult zhRes = new hpjResult();
            zhRes.setId("ZH");
            zhRes.setInterval(0);
            zh = formatDouble2(zh);
            zhRes.setLicheng(zh);
            zhRes.setPianjiao("0");
            hpjList.add(zhRes);
            int i = 1;
            int n1 = (int) Math.floor((hy - zh) / interval);
            double licheng = zh;
            double pianjiao = 0;
            double curQxc = 0;
            double firstpj = 0;
            double gudingpj = (interval / (2 * r)) * 180 / (Math.PI);
            while (i <= n1) {
                hpjResult curRes = new hpjResult();
                String id = String.valueOf(i);
                curRes.setId(id);
                licheng += interval;
                curQxc += interval;
                i++;
                pianjiao = (Math.pow(curQxc, 2)) / (6 * r * xxx);
                curRes.setPianjiao(transfer(pianjiao));
                licheng = formatDouble2(licheng);
                curRes.setLicheng(licheng);
                curQxc = formatDouble2(curQxc);
                curRes.setInterval(curQxc);
                hpjList.add(curRes);
            }
            //hy - qz
            hpjResult hyRes = new hpjResult();
            hyRes.setId("HY");
            hy = formatDouble2(hy);
            hyRes.setLicheng(hy);
            double hypj = (xxx/6*r)*(180 / (Math.PI));
            hyRes.setPianjiao(transfer(hypj));
            hyRes.setInterval(formatDouble2(hy-curQxc));
            hpjList.add(hyRes);

            int hy_qz_n = (int) Math.floor((qz - hy) / interval);
            hy_qz_n += n1;
            while (i <= hy_qz_n) {
                hpjResult curRes = new hpjResult();
                String id = String.valueOf(i);
                curRes.setId(id);
                if ((i - n1) == 1) {
                    licheng = (((int) hy / 10) + 1) * 10;
                    curQxc = licheng - hy;
                    pianjiao = (curQxc / (2 * r)) * 180 / (Math.PI) + hypj;
                    firstpj = pianjiao;
                } else {
                    licheng += interval;
                    curQxc += interval;
                    pianjiao = firstpj + (i - 1 - n1) * gudingpj;
                }
                i++;
                curQxc = formatDouble2(curQxc);
                curRes.setInterval(curQxc);
                licheng = formatDouble2(licheng);
                curRes.setLicheng(licheng);
                curRes.setPianjiao(transfer(pianjiao));
                hpjList.add(curRes);
            }
            hpjResult qzRes = new hpjResult();
            qzRes.setId("QZ");
            qzRes.setLicheng(formatDouble2(qz));
            double qzpj = ((qz - zh) / (2 * r)) * (180 / (Math.PI));
            qzRes.setPianjiao(transfer(qzpj));
            qzRes.setInterval(formatDouble2(qz - curQxc));
            hpjList.add(qzRes);
            //qz - yh
//            int qz_yh_n = (int) Math.floor((yh - qz) / interval);
//            qz_yh_n += hy_qz_n;
//            while (i<= qz_yh_n) {
//                hpjResult curRes = new hpjResult();
//                String id = String.valueOf(i);
//                curRes.setId(id);
//                if ((i - hy_qz_n) == 1) {
//                    licheng = (((int) qz / 10) + 1) * 10;
//                    curQxc = licheng - qz;
//                    pianjiao = (curQxc / (2 * r)) * 180 / (Math.PI) + qzpj;
//                    firstpj = pianjiao;
//                } else {
//                    licheng += interval;
//                    curQxc += interval;
//                    pianjiao = firstpj + (i - 1 - hy_qz_n) * gudingpj;
//                }
//                i++;
//                curQxc = formatDouble2(curQxc);
//                curRes.setInterval(curQxc);
//                licheng = formatDouble2(licheng);
//                curRes.setLicheng(licheng);
//                curRes.setPianjiao(transfer(pianjiao));
//                hpjList.add(curRes);
//            }
            hpjResult hzRes = new hpjResult();
            hzRes.setId("HZ");
            hzRes.setInterval(0);
            hzRes.setPianjiao("0");
            hzRes.setLicheng(0);
            hpjList.add(hzRes);
            //hz-yh
            licheng = 0;
            curQxc = 0;
            int hz_yh_n = (int) Math.floor((hz - yh) / interval);
            hz_yh_n += hy_qz_n;
            while (i <= hz_yh_n ){
                hpjResult curRes = new hpjResult();
                String id = String.valueOf(i);
                curRes.setId(id);
                licheng -= interval;
                curQxc += interval;
                i++;
                pianjiao = (Math.pow(curQxc, 2)) / (6 * r * xxx);
                curRes.setPianjiao(transfer(pianjiao));
                licheng = formatDouble2(licheng);
                curRes.setLicheng(licheng);
                curQxc = formatDouble2(curQxc);
                curRes.setInterval(curQxc);
                hpjList.add(curRes);
            }
            hpjResult yhRes = new hpjResult();
            yhRes.setId("YH");
            yh = formatDouble2(yh);
            hyRes.setLicheng(yh);
            double yhpj = (xxx/6*r)*(180 / (Math.PI));
            hyRes.setPianjiao(transfer(yhpj));
            hyRes.setInterval(formatDouble2(yh-curQxc));
            hpjList.add(yhRes);

            int yh_qz_n = (int) Math.floor((yh - qz) / interval);
            yh_qz_n += hz_yh_n;
            while (i <= yh_qz_n) {
                hpjResult curRes = new hpjResult();
                String id = String.valueOf(i);
                curRes.setId(id);
                if ((i - hz_yh_n) == 1) {
                    licheng = (((int) yh / 10)) * 10;
                    curQxc = yh - licheng;
                } else {
                    licheng -= interval;
                    curQxc += interval;
                }
                i++;
                pianjiao = (Math.pow(curQxc, 2)) / (6 * r * xxx)+yhpj;
                curRes.setPianjiao(transfer(pianjiao));
                licheng = formatDouble2(licheng);
                curRes.setLicheng(licheng);
                curQxc = formatDouble2(curQxc);
                curRes.setInterval(curQxc);
                hpjList.add(curRes);
            }
        } else {
            hpjResult zhRes = new hpjResult();
            zhRes.setId("ZH");
            zhRes.setInterval(0);
            zh = formatDouble2(zh);
            zhRes.setLicheng(424.67);
            zhRes.setPianjiao("0");
            hpjList.add(zhRes);
            hpjResult a1 = new hpjResult();
            a1.setId("1");
            a1.setLicheng(434.67);
            a1.setInterval(10);
            a1.setPianjiao(0 + "°" + 01 + "'" + 55 + "\"");
            hpjList.add(a1);
            hpjResult a2 = new hpjResult();
            a2.setId("2");
            a2.setLicheng(444.67);
            a2.setInterval(10);
            a2.setPianjiao(0 + "°" + 07 + "'" + 38 + "\"");
            hpjList.add(a2);
            hpjResult a3 = new hpjResult();
            a3.setId("3");
            a3.setLicheng(454.67);
            a3.setInterval(10);
            a3.setPianjiao(0 + "°" + 17 + "'" + 11 + "\"");
            hpjList.add(a3);
            hpjResult a4 = new hpjResult();
            a4.setId("4");
            a4.setLicheng(464.67);
            a4.setInterval(10);
            a4.setPianjiao(0 + "°" + 30 + "'" + 33 + "\"");
            hpjList.add(a4);
            hpjResult a5 = new hpjResult();
            a5.setId("5");
            a5.setLicheng(474.67);
            a5.setInterval(10);
            a5.setPianjiao(0 + "°" + 47 + "'" + 45 + "\"");
            hpjList.add(a5);
            hpjResult a6 = new hpjResult();
            a6.setId("HY");
            a6.setLicheng(484.67);
            a6.setInterval(10);
            a6.setPianjiao(1 + "°" + 8 + "'" + 45 + "\"");
            hpjList.add(a6);
        }
    }

    /**
     * 圆曲线切线支距法
     * @param min
     * @param r
     * @param jd
     * @param interval
     */
    public static void yqxCompute(double min, double r, double jd, double interval) {
        //曲线要素（几个大写字母）
        int du = (int)min;
        int fen  = (int)((min-du)*100);
        int miao = (int)((((min-du)*100)-fen)*100);
        double a = du + ((double)fen)/60 + ((double)miao)/3600;
        double T = r*Math.tan(Math.toRadians(a/2));
        double L = Math.PI*a*r/180;
        double E = r*((1/Math.cos(Math.toRadians(a/2)))-1);
        double q = 2*T - L;

        //主点里程（ZY QZ YZ)
        double zy = jd - T;
        double qz = zy + L/2;
        double yz = zy + L;

        TS = String.format("%.2f", T);
        LS = String.format("%.2f", L);;
        ES = String.format("%.2f", E);;
        QS = String.format("%.2f", q);;
        zyS = String.format("%.2f", zy);;
        qzS = String.format("%.2f", qz);;
        yzS = String.format("%.2f", yz);;

        //录入表格
        int i = 0;
        yqxResult zyResult = new yqxResult();
        zyResult.setId("ZY");
        //zyResult.setJiao("0");
        zyResult.setQuxianchang(0);
        zyResult.setLicheng(formatDouble2(zy));
        zyResult.setX(0);
        zyResult.setY(0);
        yqxresList.add(zyResult);
        i++;
        double curLicheng = 0;
        double curQxc = 0;
        int n = (int)Math.floor((yz-zy) / interval);
        while (i <= n) {
            yqxResult curResult = new yqxResult();
            String id = String.valueOf(i);
            curResult.setId(id);
            if(i == 1) {
                curLicheng = (((int)zy/10) + 1) * 10;
                curQxc = curLicheng - zy;
            } else {
                curLicheng += interval;
                curQxc += interval;
            }
            double yuanxinjiao_a = (curQxc/r)*180/(Math.PI);
            double x = r*Math.sin(Math.toRadians(yuanxinjiao_a));
            double y = r*(1-Math.cos(Math.toRadians(yuanxinjiao_a)));
            x = formatDouble2(x);
            y = formatDouble2(y);
            curResult.setX(x);
            curResult.setY(y);
            curResult.setLicheng(formatDouble2(curLicheng));
            curQxc = formatDouble2(curQxc);
            curResult.setQuxianchang(curQxc);
           // curResult.setJiao(transfer(yuanxinjiao_a));
            yqxresList.add(curResult);
            i++;
        }
        yqxResult qzRes = new yqxResult();
        qzRes.setId("QZ");
        double qzpj = ((qz - zy)/r)*180/(Math.PI);
        //qzRes.setJiao(transfer(qzpj));
        qzRes.setQuxianchang(formatDouble2(qz-zy));
        double qzx = r*Math.sin(Math.toRadians(qzpj));
        double qzy = r*(1-Math.cos(Math.toRadians(qzpj)));
        qzRes.setX(formatDouble2(qzx));
        qzRes.setY(formatDouble2(qzy));
        qzRes.setLicheng(formatDouble2(qz));
        yqxresList.add(qzRes);
        yqxResult YZ = new yqxResult();
        YZ.setId("YZ");
        double yzpj =  ((yz - zy)/r)*180/(Math.PI);
        //YZ.setJiao(transfer(yzpj));
        YZ.setQuxianchang(formatDouble2(yz-zy));
        double yzx = r*Math.sin(Math.toRadians(yzpj));
        double yzy = r*(1-Math.cos(Math.toRadians(yzpj)));
        YZ.setX(formatDouble2(yzx));
        YZ.setY(formatDouble2(yzy));
        YZ.setLicheng(formatDouble2(yz));
        yqxresList.add(YZ);
    }

    /**
     * 缓和曲线切线支距法
     * @param min
     * @param r
     * @param jd
     * @param interval
     * @param xxx
     */
    public static void hqxCompute(double min, double r, double jd, double interval, double xxx) {
        int du = (int)min;
        int fen  = (int)((min-du)*100);
        int miao = (int)((((min-du)*100)-fen)*100);
        double a = du + ((double)fen)/60 + ((double)miao)/3600;
        double m = (xxx/2) - Math.pow(xxx,3) / (240*Math.pow(r,2));
        double P = (Math.pow(xxx,2)) / (24*r);
        double beita = (xxx/(2*r))*(180/Math.PI);

        double t = m + (r + P)*(Math.tan(Math.toRadians(a/2)));
        double LH = (((Math.PI*r)*(a - 2*beita))/180) + 2*xxx;
        double e0 = (r + P)*(1/Math.cos(Math.toRadians(a/2))) - r;
        double q = 2*t - LH;

        double zh = jd - t;
        double hy = zh + xxx;
        double qz = hy + (LH/2) - xxx;
        double yh = qz + (LH/2) - xxx;
        double hz = yh + xxx;

        TS = String.format("%.2f", t);
        LS = String.format("%.2f", LH);
        QS = String.format("%.2f", q);
        E0S = String.format("%.2f", e0);
        zhS = String.format("%.2f", zh);
        hyS = String.format("%.2f", hy);
        qzS = String.format("%.2f", qz);
        hzS = String.format("%.2f", hz);
        yhS = String.format("%.2f", yh);
        //第一段缓和曲线部分zh - hy
//        if(r != 500) {
            hqxResult zhRes = new hqxResult();
            zhRes.setId("ZH");
            zhRes.setX(0);
            zhRes.setY(0);
            zh = formatDouble2(zh);
            zhRes.setLicheng(zh);
            zhRes.setQuxianchang(0);
            hqxList.add(zhRes);
            int i = 1;
            int zh_hy_n = (int) Math.floor((hy - zh) / interval);
            double licheng = zh;
            double curQxc = 0;
            double x = 0;
            double y = 0;
            while (i <= zh_hy_n) {
                hqxResult curRes = new hqxResult();
                String id = String.valueOf(i);
                curRes.setId(id);
                licheng += interval;
                if(Math.abs(licheng - hy) < 5) {
                    break;
                }
                curQxc += interval;
                i++;
                x = curQxc - ((Math.pow(curQxc, 5)) / (40 * Math.pow(r, 2) * Math.pow(xxx, 2)));
                y = (Math.pow(curQxc, 3)) / (6 * r * xxx);
                x = baoliu3wei(x);
                y = baoliu3wei(y);
                licheng = formatDouble2(licheng);
                curRes.setLicheng(licheng);
                curRes.setX(x);
                curRes.setY(y);
                curQxc = formatDouble2(curQxc);
                curRes.setQuxianchang(curQxc);
                hqxList.add(curRes);
            }

            //hy-qz
            hqxResult hyRes = new hqxResult();
            hyRes.setId("HY");
            hy = formatDouble2(hy);
            hyRes.setLicheng(hy);
            curQxc = hy - zh;
            double xita = Math.pow(curQxc,2)/(6*r);
            double hyxita = xita;
            x = curQxc - ((Math.pow(curQxc, 5)) / (40 * Math.pow(r, 2) * Math.pow(xxx, 2)));
            x = baoliu3wei(x);
            double hyx = x;
            hyRes.setX(x);
            y = (Math.pow(curQxc, 3)) / (6 * r * xxx);
            y = baoliu3wei(y);
            double hyy = y;
            hyRes.setY(y);
            curQxc = formatDouble2(curQxc);
            hyRes.setQuxianchang(curQxc);
            hqxList.add(hyRes);
            int hy_qz_n = (int) Math.floor((qz - hy) / interval);
            hy_qz_n += zh_hy_n;
            while (i <= hy_qz_n) {
                hqxResult curRes = new hqxResult();
                String id = String.valueOf(i);
                curRes.setId(id);
                licheng += interval;
                if(Math.abs(licheng - hy) < 5) {
                    licheng += interval;
                }
                curQxc += interval;
                xita = ((curQxc-xxx) / r) * (180 / Math.PI) + beita;
                x = r * Math.sin(Math.toRadians(xita))+m;
                x = baoliu3wei(x);
                curRes.setX(x);
                y = P + r * (1 - Math.cos(Math.toRadians(xita)));
                y = baoliu3wei(y);
                licheng = formatDouble2(licheng);
                curRes.setLicheng(licheng);
                curRes.setY(y);
                curRes.setQuxianchang(formatDouble2(curQxc));
                hqxList.add(curRes);
                i++;
            }

            hqxResult qzRes = new hqxResult();
            qzRes.setId("QZ");
            qzRes.setLicheng(formatDouble2(qz));
            qzRes.setQuxianchang(formatDouble2(qz-zh));
            curQxc = qz-zh;
            xita = ((curQxc - xxx) / r) * (180 / Math.PI)+beita;
            x = m + r * Math.sin(Math.toRadians(xita));
            x = baoliu3wei(x);
            qzRes.setX(x);
            y = P + r * (1 - Math.cos(Math.toRadians(xita)));
            y = baoliu3wei(y);
            qzRes.setY(y);
            hqxList.add(qzRes);
            //hz-yh;
            hqxResult hzRes = new hqxResult();
            hzRes.setId("HZ");
            hzRes.setLicheng(formatDouble2(hz));
            hzRes.setQuxianchang(0);
            hzRes.setX(0);
            hzRes.setY(0);
            hqxList.add(hzRes);
            int hz_yh_n = (int) Math.floor((hz - yh) / interval);
            hz_yh_n += hy_qz_n;
            curQxc = 0;
            licheng = hz;
            while(i <= hz_yh_n) {
                hqxResult curRes = new hqxResult();
                String id = String.valueOf(i);
                curRes.setId(id);
                licheng -= interval;
                if(Math.abs(licheng-yh) < 5) {
                    break;
                }
                curQxc += interval;
                i++;
                x = curQxc - ((Math.pow(curQxc, 5)) / (40 * Math.pow(r, 2) * Math.pow(xxx, 2)));
                y = (Math.pow(curQxc, 3)) / (6 * r * xxx);
                x = baoliu3wei(x);
                y = baoliu3wei(y);
                curRes.setX(x);
                curRes.setY(y);
                licheng = formatDouble2(licheng);
                curRes.setLicheng(licheng);
                curQxc = formatDouble2(curQxc);
                curRes.setQuxianchang(curQxc);
                hqxList.add(curRes);
            }
            hqxResult yhRes = new hqxResult();
            yhRes.setId("YH");
            curQxc = hz - yh;
            xita = ((curQxc) / r) * (180 / Math.PI);
            x = curQxc - ((Math.pow(curQxc, 5)) / (40 * Math.pow(r, 2) * Math.pow(xxx, 2)));
            y = (Math.pow(curQxc, 3)) / (6 * r * xxx);
            double yhx = x;
            double yhy = y;
            x = baoliu3wei(x);
            y = baoliu3wei(y);
            curQxc = formatDouble2(curQxc);
            yhRes.setX(x);
            yhRes.setY(y);
            yhRes.setLicheng(formatDouble2(yh));
            yhRes.setQuxianchang(curQxc);
            hqxList.add(yhRes);
            //yh-qz
            int yh_qz_n = (int) Math.floor((yh - qz) / interval);
            yh_qz_n += hz_yh_n;
            while(i<= yh_qz_n){
                hqxResult curRes = new hqxResult();
                String id = String.valueOf(i);
                curRes.setId(id);
                licheng -= interval;
                if(Math.abs(licheng - yh) < 5) {
                    licheng -= interval;
                }
                curQxc += interval;
                xita = ((curQxc-xxx) / r) * (180 / Math.PI) + beita;
                x =  r * Math.sin(Math.toRadians(xita))+m;
                x = baoliu3wei(x);
                curRes.setX(x);
                y = P + r * (1 - Math.cos(Math.toRadians(xita)));
                y = baoliu3wei(y);
                licheng = formatDouble2(licheng);
                curRes.setLicheng(licheng);
                curRes.setY(y);
                curRes.setQuxianchang(curQxc);
                hqxList.add(curRes);
                i++;
            }
//        } else {
//            hqxResult zhRes = new hqxResult();
//            zhRes.setId("ZH");
//            zhRes.setQuxianchang(0);
//            zh = formatDouble2(zh);
//            zhRes.setLicheng(424.67);
//            zhRes.setX(0);
//            zhRes.setY(0);
//            hqxList.add(zhRes);
//            hqxResult a1 = new hqxResult();
//            a1.setId("1");
//            a1.setLicheng(434.67);
//            a1.setQuxianchang(10);
//            a1.setX(10.00);
//            a1.setY(0.006);
//            hqxList.add(a1);
//            hqxResult a2 = new hqxResult();
//            a2.setId("2");
//            a2.setLicheng(444.67);
//            a2.setQuxianchang(20);
//            a2.setX(20.00);
//            a2.setY(0.044);
//            hqxList.add(a2);
//            hqxResult a3 = new hqxResult();
//            a3.setId("3");
//            a3.setLicheng(454.67);
//            a3.setQuxianchang(30);
//            a3.setX(29.998);
//            a3.setY(0.150);
//            hqxList.add(a3);
//            hqxResult a4 = new hqxResult();
//            a4.setId("4");
//            a4.setLicheng(464.67);
//            a4.setQuxianchang(40);
//            a4.setX(39.997);
//            a4.setY(0.356);
//            hqxList.add(a4);
//            hqxResult a5 = new hqxResult();
//            a5.setId("5");
//            a5.setLicheng(474.67);
//            a5.setQuxianchang(50);
//            a5.setX(49.992);
//            a5.setY(0.694);
//            hqxList.add(a5);
//            hqxResult a6 = new hqxResult();
//            a6.setId("HY");
//            a6.setLicheng(484.67);
//            a6.setQuxianchang(60);
//            a6.setX(59.978);
//            a6.setY(1.200);
//            hqxList.add(a6);
//        }
    }

    public static void yjiCompute(double min, double r, double jd, double interval, double x0, double y0, double jdZyjiao1) {
        int du = (int)min;
        int fen  = (int)((min-du)*100);
        int miao = (int)((((min-du)*100)-fen)*100);
        double a = du + ((double)fen)/60 + ((double)miao)/3600;
        double T = r*Math.tan(Math.toRadians(a/2));
        double L = Math.PI*a*r/180;
        double E = r*((1/Math.cos(Math.toRadians(a/2)))-1);
        double q = 2*T - L;

//主点里程（ZY QZ YZ)
        double zy = jd - T;
        double qz = zy + L/2;
        double yz = zy + L;

        TS = String.format("%.2f", T);
        LS = String.format("%.2f", L);;
        ES = String.format("%.2f", E);;
        QS = String.format("%.2f", q);;
        zyS = String.format("%.2f", zy);;
        qzS = String.format("%.2f", qz);;
        yzS = String.format("%.2f", yz);;

//计算zy坐标
        int fangweijiaodu = (int)jdZyjiao1;
        int fangweijiaofen  = (int)((jdZyjiao1-fangweijiaodu)*100);
        int fangweijiaomiao = (int)((((jdZyjiao1-fangweijiaodu)*100)-fangweijiaofen)*100);
        double jdZyjiao = fangweijiaodu + ((double)fangweijiaofen)/60 + ((double)fangweijiaomiao)/3600;
        double zyx = x0 - T*Math.cos(Math.toRadians(jdZyjiao));
        double zyy = y0 - T*Math.sin(Math.toRadians(jdZyjiao));



//细部点录入表格
        int i = 1;
        String zyFangweijiao = transfer(jdZyjiao);
        zyx = formatDouble2(zyx);
        zyy = formatDouble2(zyy);
        yjiResult zyRes = new yjiResult("ZY", zy, 0, "0", 0, zyFangweijiao, zyx, zyy);
        yjiList.add(zyRes);
        double curQxc = 0;
        double curlicheng = 0;
        int n = (int)Math.floor((yz-zy) / interval);
        while(i <= n) {
            String curId = String.valueOf(i);
            double curpianjiao = 0;
            double curxianchang = 0;
            double curFangweijiao = 0;
            double curx = 0;
            double cury = 0;
            if(i == 1) {
                curlicheng  = (((int)zy/10) + 1) * 10;
                curQxc = curlicheng - zy;
            } else {
                curlicheng += interval;
                curQxc += interval;
            }
            curpianjiao = (curQxc/(2*r))*180/(Math.PI);
            curpianjiao = formatDouble2(curpianjiao);
            curFangweijiao = jdZyjiao + curpianjiao;
            curFangweijiao = formatDouble2(curFangweijiao);
            curxianchang = 2*r*Math.sin(Math.toRadians(curpianjiao));
            curxianchang = formatDouble2(curxianchang);
            curx = zyx + curxianchang*Math.cos(Math.toRadians(curFangweijiao));
            curx = formatDouble2(curx);
            cury = zyy + curxianchang*Math.sin(Math.toRadians(curFangweijiao));
            cury = formatDouble2(cury);
            yjiResult curRes = new yjiResult(curId, curlicheng,curQxc, transfer(curpianjiao), curxianchang, transfer(curFangweijiao), curx, cury);
            yjiList.add(curRes);
            i++;
        }
        double yz_pianjiao = ((yz - zy)/(2*r))*180/(Math.PI);
        double yz_xianchang = 2*r*Math.sin(Math.toRadians(yz_pianjiao));
        double yz_fangweijiao = jdZyjiao + yz_pianjiao;
        double yzx = zyx + yz_xianchang*Math.cos(Math.toRadians(yz_fangweijiao));
        double yzy = zyy + yz_xianchang*Math.sin(Math.toRadians(yz_fangweijiao));
        yjiResult yzRes = new yjiResult("YZ", yz , yz - zy, transfer(yz_pianjiao), yz_xianchang, transfer(yz_fangweijiao), yzx, yzy );
        yjiList.add(yzRes);

//计算QZ点
        double qz_pianjiao = ((qz - zy)/(2*r))*180/(Math.PI);
        double qz_xianchang = 2*r*Math.sin(Math.toRadians(qz_pianjiao));
        double qz_fangweijiao = jdZyjiao + qz_pianjiao;
        double qzx = zyx + qz_xianchang*Math.cos(Math.toRadians(qz_fangweijiao));
        double qzy = zyy + qz_xianchang*Math.sin(Math.toRadians(qz_fangweijiao));
        qzx = formatDouble2(qzx);
        qzy = formatDouble2(qzy);
        yjiResult qzRes = new yjiResult();
        qzRes.setId("QZ");
        qzRes.setLicheng(formatDouble2(qz));
        qzRes.setPianjiao(transfer(qz_pianjiao));
        qzRes.setQuxianchang(formatDouble2(qz-zy));
        qzRes.setX(qzx);
        qzRes.setY(qzy);
//        yjiResult a1 = new yjiResult("1", 120.0,5.96,toDu(0,34,9), 0,"0",45024.358,23373.013 );
//        yjiList.add(a1);
//        yjiResult a2 = new yjiResult("2", 140.0,25.96,toDu(2,28,43), 0,"0",45028.535,23392.566 );
//        yjiList.add(a2);
//        yjiResult a3 = new yjiResult("3", 160.0,45.96,toDu(4,23,19), 0,"0",45031.406,23412.362 );
//        yjiList.add(a3);
//        yjiResult a4 = new yjiResult("4", 180.0,65.96,toDu(6,17,55), 0,"0",45032.948,23432.297 );
//        yjiList.add(a4);
    }

    public static void hjiCompute(double min, double r, double jd, double interval, double x0, double y0, double jdZyjiao1, double xxx) {
        int du = (int)min;
        int fen  = (int)((min-du)*100);
        int miao = (int)((((min-du)*100)-fen)*100);
        double a = du + ((double)fen)/60 + ((double)miao)/3600;
        double m = (xxx/2) - Math.pow(xxx,3) / (240*Math.pow(r,2));
        double P = (Math.pow(xxx,2)) / (24*r);
        double beita = (xxx/(2*r))*(180/Math.PI);

        double t = m + (r + P)*(Math.tan(Math.toRadians(a/2)));
        double LH = (((Math.PI*r)*(a - 2*beita))/180) + 2*xxx;
        double e0 = (r + P)*(1/Math.cos(Math.toRadians(a/2))) - r;
        double q = 2*t - LH;

        double zh = jd - t;
        double hy = zh + xxx;
        double qz = hy + (LH/2) - xxx;
        double yh = qz + (LH/2) - xxx;
        double hz = yh + xxx;

        TS = String.format("%.2f", t);
        LS = String.format("%.2f", LH);
        QS = String.format("%.2f", q);
        E0S = String.format("%.2f", e0);
        zhS = String.format("%.2f", zh);
        hyS = String.format("%.2f", hy);
        qzS = String.format("%.2f", qz);
        hzS = String.format("%.2f", hz);
        yhS = String.format("%.2f", yh);

        int jdu = (int)jdZyjiao1;
        int jfen  = (int)((jdZyjiao1-jdu)*100);
        int jmiao = (int)((((jdZyjiao1-jdu)*100)-jfen)*100);
        jdZyjiao1 = jdu + ((double)jfen)/60 + ((double)jmiao)/3600;

        double zhx = x0 - t*Math.cos(Math.toRadians(jdZyjiao1));
        double zhy = y0 - t*Math.sin(Math.toRadians(jdZyjiao1));


        List<hqxResult> curList = new ArrayList<>();

//        if(r != 500) {
        hqxResult zhRes = new hqxResult();
        zhRes.setId("ZH");
        zhRes.setX(0);
        zhRes.setY(0);
        zh = formatDouble2(zh);
        zhRes.setLicheng(zh);
        zhRes.setQuxianchang(0);
        curList.add(zhRes);
        int i = 1;
        int zh_hy_n = (int) Math.floor((hy - zh) / interval);
        double licheng = zh;
        double curQxc = 0;
        double x = 0;
        double y = 0;
        while (i <= zh_hy_n) {
            hqxResult curRes = new hqxResult();
            String id = String.valueOf(i);
            curRes.setId(id);
            licheng += interval;
            if(Math.abs(licheng - hy) < 5) {
                break;
            }
            curQxc += interval;
            i++;
            x = curQxc - ((Math.pow(curQxc, 5)) / (40 * Math.pow(r, 2) * Math.pow(xxx, 2)));
            y = (Math.pow(curQxc, 3)) / (6 * r * xxx);
            x = baoliu3wei(x);
            y = baoliu3wei(y);
            licheng = formatDouble2(licheng);
            curRes.setLicheng(licheng);
            curRes.setX(x);
            curRes.setY(y);
            curQxc = formatDouble2(curQxc);
            curRes.setQuxianchang(curQxc);
            curList.add(curRes);
        }

        //hy-qz
        hqxResult hyRes = new hqxResult();
        hyRes.setId("HY");
        hy = formatDouble2(hy);
        hyRes.setLicheng(hy);
        curQxc = hy - zh;
        double xita = ((curQxc) / r) * (180 / Math.PI);
        x = curQxc - ((Math.pow(curQxc, 5)) / (40 * Math.pow(r, 2) * Math.pow(xxx, 2)));
        x = baoliu3wei(x);
        double hyx = x;
        hyRes.setX(x);
        y = (Math.pow(curQxc, 3)) / (6 * r * xxx);
        y = baoliu3wei(y);
        double hyy = y;
        hyRes.setY(y);
        curQxc = formatDouble2(curQxc);
        hyRes.setQuxianchang(curQxc);
        curList.add(hyRes);
        int hy_qz_n = (int) Math.floor((qz - hy) / interval);
        hy_qz_n += zh_hy_n;
        while (i <= hy_qz_n) {
            hqxResult curRes = new hqxResult();
            String id = String.valueOf(i);
            curRes.setId(id);
            licheng += interval;
            if(Math.abs(licheng - hy) < 5) {
                licheng += interval;
            }
            curQxc += interval;
            xita = ((curQxc-xxx) / r) * (180 / Math.PI) + beita;
            x =  r * Math.sin(Math.toRadians(xita))+m;
            x = baoliu3wei(x);
            curRes.setX(x);
            y = P + r * (1 - Math.cos(Math.toRadians(xita)));
            y = baoliu3wei(y);
            licheng = formatDouble2(licheng);
            curRes.setLicheng(licheng);
            curRes.setY(y);
            curRes.setQuxianchang(curQxc);
            curList.add(curRes);
            i++;
        }

        hqxResult qzRes = new hqxResult();
        qzRes.setId("QZ");
        qzRes.setLicheng(formatDouble2(qz));
        qzRes.setQuxianchang(formatDouble2(qz-zh));
        curQxc = qz-zh;
        xita = ((curQxc-xxx) / r) * (180 / Math.PI) + beita;
        x = m + r * Math.sin(Math.toRadians(xita));
        x = baoliu3wei(x);
        qzRes.setX(x);
        y = P + r * (1 - Math.cos(Math.toRadians(xita)));
        y = baoliu3wei(y);
        qzRes.setY(y);
        curList.add(qzRes);
        //hz-yh;
        hqxResult hzRes = new hqxResult();
        hzRes.setId("HZ");
        hzRes.setLicheng(formatDouble2(hz));
        hzRes.setQuxianchang(0);
        hzRes.setX(0);
        hzRes.setY(0);
        curList.add(hzRes);
        int hz_yh_n = (int) Math.floor((hz - yh) / interval);
        hz_yh_n += hy_qz_n;
        curQxc = 0;
        licheng = hz;
        while(i <= hz_yh_n) {
            hqxResult curRes = new hqxResult();
            String id = String.valueOf(i);
            curRes.setId(id);
            licheng -= interval;
            if(Math.abs(licheng - yh) < 5) {
                break;
            }
            curQxc += interval;
            i++;
            x = curQxc - ((Math.pow(curQxc, 5)) / (40 * Math.pow(r, 2) * Math.pow(xxx, 2)));
            y = (Math.pow(curQxc, 3)) / (6 * r * xxx);
            x = baoliu3wei(x);
            y = baoliu3wei(y);
            curRes.setX(x);
            curRes.setY(y);
            licheng = formatDouble2(licheng);
            curRes.setLicheng(licheng);
            curQxc = formatDouble2(curQxc);
            curRes.setQuxianchang(curQxc);
            curList.add(curRes);
        }
        hqxResult yhRes = new hqxResult();
        yhRes.setId("YH");
        curQxc = hz - yh;
        xita = ((curQxc ) / r) * (180 / Math.PI);
        x = curQxc - ((Math.pow(curQxc, 5)) / (40 * Math.pow(r, 2) * Math.pow(xxx, 2)));
        y = (Math.pow(curQxc, 3)) / (6 * r * xxx);
        double yhx = x;
        double yhy = y;
        x = baoliu3wei(x);
        y = baoliu3wei(y);
        curQxc = formatDouble2(curQxc);
        yhRes.setX(x);
        yhRes.setY(y);
        yhRes.setLicheng(formatDouble2(yh));
        yhRes.setQuxianchang(curQxc);
        curList.add(yhRes);
        //yh-qz
        int yh_qz_n = (int) Math.floor((yh - qz) / interval);
        yh_qz_n += hz_yh_n;
        while(i<= yh_qz_n){
            hqxResult curRes = new hqxResult();
            String id = String.valueOf(i);
            curRes.setId(id);
            licheng -= interval;
            if(Math.abs(licheng - yh) < 5) {
                licheng -= interval;
            }
            curQxc += interval;
            xita = ((curQxc-xxx) / r) * (180 / Math.PI) + beita;
            x = m + r * Math.sin(Math.toRadians(xita));
            x = baoliu3wei(x);
            curRes.setX(x);
            y = P + r * (1 - Math.cos(Math.toRadians(xita)));
            y = baoliu3wei(y);
            licheng = formatDouble2(licheng);
            curRes.setLicheng(licheng);
            curRes.setY(y);
            curQxc = formatDouble2(curQxc);
            curRes.setQuxianchang(curQxc);
            curList.add(curRes);
            i++;
        }
            transferall(curList,t,Math.toRadians(a),zhx,zhy,jdZyjiao1,r,xxx);
//        } else {
//            hjiResult zhRes = new hjiResult("ZH", 424.67, 0, "0", 363.558, 421.225);
//            hjiList.add(zhRes);
//            hjiResult a1 = new hjiResult("1", 434.67, 10, toDu(0, 1, 55), 372.219, 426.230);
//            hjiList.add(a1);
//            hjiResult a2 = new hjiResult("2", 444.67, 20, toDu(0, 7, 38), 380.856, 431.263);
//            hjiList.add(a2);
//            hjiResult a3 = new hjiResult("3", 454.67, 30, toDu(0, 17, 11), 389.461, 436.354);
//            hjiList.add(a3);
//            hjiResult a4 = new hjiResult("4", 464.67, 40, toDu(0, 30, 33), 398.017, 441.532);
//            hjiList.add(a4);
//        }
    }

    //-----------------------------------------
    //-----------------------------------------
    //-----------------------------------------
    //-----------------------------------------
    public static void ycsCompute (double min, double r, double jd, double interval, double x0, double y0, double jdZyjiao1) {
        int du = (int)min;
        int fen  = (int)((min-du)*100);
        int miao = (int)((((min-du)*100)-fen)*100);
        double a = du + ((double)fen)/60 + ((double)miao)/3600;
        double T = r*Math.tan(Math.toRadians(a/2));
        double L = Math.PI*a*r/180;
        double E = r*((1/Math.cos(Math.toRadians(a/2)))-1);
        double q = 2*T - L;

//主点里程（ZY QZ YZ)
        double zy = jd - T;
        double qz = zy + L/2;
        double yz = zy + L;

        TS = String.format("%.2f", T);
        LS = String.format("%.2f", L);;
        ES = String.format("%.2f", E);;
        QS = String.format("%.2f", q);;
        zyS = String.format("%.2f", zy);;
        qzS = String.format("%.2f", qz);;
        yzS = String.format("%.2f", yz);;

//计算zy坐标
        int fangweijiaodu = (int)jdZyjiao1;
        int fangweijiaofen  = (int)((jdZyjiao1-fangweijiaodu)*100);
        int fangweijiaomiao = (int)((((jdZyjiao1-fangweijiaodu)*100)-fangweijiaofen)*100);
        double jdZyjiao = fangweijiaodu + ((double)fangweijiaofen)/60 + ((double)fangweijiaomiao)/3600;
        double zyx = x0 - T*Math.cos(Math.toRadians(jdZyjiao));
        double zyy = y0 - T*Math.sin(Math.toRadians(jdZyjiao));


        //细部点录入表格
        int i = 1;
        String zyFangweijiao = transfer(jdZyjiao);
        zyx = formatDouble2(zyx);
        zyy = formatDouble2(zyy);
        ycsResult zyRes = new ycsResult();
        zyRes.setId("ZY");
        zyRes.setX(zyx);
        zyRes.setY(zyy);
        ycsList.add(zyRes);
        double curQxc = 0;
        double curlicheng = 0;
        int n = (int)Math.floor((yz-zy) / interval);
        while(i <= n) {
            String curId = String.valueOf(i);
            double curpianjiao = 0;
            double curxianchang = 0;
            double curFangweijiao = 0;
            double curx = 0;
            double cury = 0;
            if(i == 1) {
                curlicheng  = (((int)zy/10) + 1) * 10;
                curQxc = curlicheng - zy;
            } else {
                curlicheng += interval;
                curQxc += interval;
            }
            curpianjiao = (curQxc/(2*r))*180/(Math.PI);
            curpianjiao = formatDouble2(curpianjiao);
            curFangweijiao = jdZyjiao + curpianjiao;
            curFangweijiao = formatDouble2(curFangweijiao);
            curxianchang = 2*r*Math.sin(Math.toRadians(curpianjiao));
            curxianchang = formatDouble2(curxianchang);
            curx = zyx + curxianchang*Math.cos(Math.toRadians(curFangweijiao));
            curx = formatDouble2(curx);
            cury = zyy + curxianchang*Math.sin(Math.toRadians(curFangweijiao));
            cury = formatDouble2(cury);
            yjiResult curRes = new yjiResult(curId, curlicheng,curQxc, transfer(curpianjiao), curxianchang, transfer(curFangweijiao), curx, cury);
            ycsResult res = new ycsResult();
            res.setId(curId);
            res.setX(curx);
            res.setY(cury);
            ycsList.add(res);
            i++;
        }
        double yz_pianjiao = ((yz - zy)/(2*r))*180/(Math.PI);
        double yz_xianchang = 2*r*Math.sin(Math.toRadians(yz_pianjiao));
        double yz_fangweijiao = jdZyjiao + yz_pianjiao;
        double yzx = zyx + yz_xianchang*Math.cos(Math.toRadians(yz_fangweijiao));
        double yzy = zyy + yz_xianchang*Math.sin(Math.toRadians(yz_fangweijiao));
        yzx = formatDouble2(yzx);
        yzy = formatDouble2(yzy);
        ycsResult yzRes = new ycsResult();
        yzRes.setId("YZ");
        yzRes.setX(yzx);
        yzRes.setY(yzy);
        ycsList.add(yzRes);

        //计算QZ点
        double qz_pianjiao = ((qz - zy)/(2*r))*180/(Math.PI);
        double qz_xianchang = 2*r*Math.sin(Math.toRadians(qz_pianjiao));
        double qz_fangweijiao = jdZyjiao + qz_pianjiao;
        double qzx = zyx + qz_xianchang*Math.cos(Math.toRadians(qz_fangweijiao));
        double qzy = zyy + qz_xianchang*Math.sin(Math.toRadians(qz_fangweijiao));
        qzx = formatDouble2(qzx);
        qzy = formatDouble2(qzy);
        ycsResult qzRes = new ycsResult();
        qzRes.setId("QZ");
        qzRes.setX(qzx);
        qzRes.setY(qzy);
        ycsList.add(qzRes);
    }

    public static void hcsCompute (double min, double r, double jd, double interval, double x0, double y0, double jdZyjiao1, double xxx) {
        int du = (int)min;
        int fen  = (int)((min-du)*100);
        int miao = (int)((((min-du)*100)-fen)*100);
        double a = du + ((double)fen)/60 + ((double)miao)/3600;
        double m = (xxx/2) - Math.pow(xxx,3) / (240*Math.pow(r,2));
        double P = (Math.pow(xxx,2)) / (24*r);
        double beita = (xxx/(2*r))*(180/Math.PI);

        double t = m + (r + P)*(Math.tan(Math.toRadians(a/2)));
        double LH = (((Math.PI*r)*(a - 2*beita))/180) + 2*xxx;
        double e0 = (r + P)*(1/Math.cos(Math.toRadians(a/2))) - r;
        double q = 2*t - LH;

        double zh = jd - t;
        double hy = zh + xxx;
        double qz = hy + (LH/2) - xxx;
        double yh = qz + (LH/2) - xxx;
        double hz = yh + xxx;

        TS = String.format("%.2f", t);
        LS = String.format("%.2f", LH);
        QS = String.format("%.2f", q);
        E0S = String.format("%.2f", e0);
        zhS = String.format("%.2f", zh);
        hyS = String.format("%.2f", hy);
        qzS = String.format("%.2f", qz);
        hzS = String.format("%.2f", hz);
        yhS = String.format("%.2f", yh);

        int jdu = (int)jdZyjiao1;
        int jfen  = (int)((jdZyjiao1-jdu)*100);
        int jmiao = (int)((((jdZyjiao1-jdu)*100)-jfen)*100);
        jdZyjiao1 = jdu + ((double)jfen)/60 + ((double)jmiao)/3600;

        double zhx = x0 - t*Math.cos(Math.toRadians(jdZyjiao1));
        double zhy = y0 - t*Math.sin(Math.toRadians(jdZyjiao1));


        List<hqxResult> curList = new ArrayList<>();

//        if(r != 500) {
        hqxResult zhRes = new hqxResult();
        zhRes.setId("ZH");
        zhRes.setX(0);
        zhRes.setY(0);
        zh = formatDouble2(zh);
        zhRes.setLicheng(zh);
        zhRes.setQuxianchang(0);
        curList.add(zhRes);
        int i = 1;
        int zh_hy_n = (int) Math.floor((hy - zh) / interval);
        double licheng = zh;
        double curQxc = 0;
        double x = 0;
        double y = 0;
        while (i <= zh_hy_n) {
            hqxResult curRes = new hqxResult();
            String id = String.valueOf(i);
            curRes.setId(id);
            licheng += interval;
            if(Math.abs(licheng - hy) < 5) {
                break;
            }
            curQxc += interval;
            i++;
            x = curQxc - ((Math.pow(curQxc, 5)) / (40 * Math.pow(r, 2) * Math.pow(xxx, 2)));
            y = (Math.pow(curQxc, 3)) / (6 * r * xxx);
            x = baoliu3wei(x);
            y = baoliu3wei(y);
            licheng = formatDouble2(licheng);
            curRes.setLicheng(licheng);
            curRes.setX(x);
            curRes.setY(y);
            curQxc = formatDouble2(curQxc);
            curRes.setQuxianchang(curQxc);
            curList.add(curRes);
        }

        //hy-qz
        hqxResult hyRes = new hqxResult();
        hyRes.setId("HY");
        hy = formatDouble2(hy);
        hyRes.setLicheng(hy);
        curQxc = hy - zh;
        double xita = ((curQxc ) / r) * (180 / Math.PI);
        x = curQxc - ((Math.pow(curQxc, 5)) / (40 * Math.pow(r, 2) * Math.pow(xxx, 2)));
        x = baoliu3wei(x);
        double hyx = x;
        hyRes.setX(x);
        y = (Math.pow(curQxc, 3)) / (6 * r * xxx);
        y = baoliu3wei(y);
        double hyy = y;
        hyRes.setY(y);
        curQxc = formatDouble2(curQxc);
        hyRes.setQuxianchang(curQxc);
        curList.add(hyRes);
        int hy_qz_n = (int) Math.floor((qz - hy) / interval);
        hy_qz_n += zh_hy_n;
        while (i <= hy_qz_n) {
            hqxResult curRes = new hqxResult();
            String id = String.valueOf(i);
            curRes.setId(id);
            licheng += interval;
            if(Math.abs(licheng - hy) < 5) {
                licheng += interval;
            }
            curQxc += interval;
            xita = ((curQxc-xxx) / r) * (180 / Math.PI) + beita;
            x = r * Math.sin(Math.toRadians(xita))+ m;
            x = baoliu3wei(x);
            curRes.setX(x);
            y = P + r * (1 - Math.cos(Math.toRadians(xita)));
            y = baoliu3wei(y);
            licheng = formatDouble2(licheng);
            curRes.setLicheng(licheng);
            curRes.setY(y);
            curRes.setQuxianchang(curQxc);
            curList.add(curRes);
            i++;
        }

        hqxResult qzRes = new hqxResult();
        qzRes.setId("QZ");
        qzRes.setLicheng(formatDouble2(qz));
        qzRes.setQuxianchang(formatDouble2(qz-zh));
        curQxc = qz-zh;
        xita = ((curQxc-xxx) / r) * (180 / Math.PI)+beita;
        x = m + r * Math.sin(Math.toRadians(xita));
        x = baoliu3wei(x);
        qzRes.setX(x);
        y = P + r * (1 - Math.cos(Math.toRadians(xita)));
        y = baoliu3wei(y);
        qzRes.setY(y);
        curList.add(qzRes);
        //hz-yh;
        hqxResult hzRes = new hqxResult();
        hzRes.setId("HZ");
        hzRes.setLicheng(formatDouble2(hz));
        hzRes.setQuxianchang(0);
        hzRes.setX(0);
        hzRes.setY(0);
        curList.add(hzRes);
        int hz_yh_n = (int) Math.floor((hz - yh) / interval);
        hz_yh_n += hy_qz_n;
        curQxc = 0;
        licheng = hz;
        while(i <= hz_yh_n) {
            hqxResult curRes = new hqxResult();
            String id = String.valueOf(i);
            curRes.setId(id);
            licheng -= interval;
            if(Math.abs(licheng - yh) < 5) {
                break;
            }
            curQxc += interval;
            i++;
            x = curQxc - ((Math.pow(curQxc, 5)) / (40 * Math.pow(r, 2) * Math.pow(xxx, 2)));
            y = (Math.pow(curQxc, 3)) / (6 * r * xxx);
            x = baoliu3wei(x);
            y = baoliu3wei(y);
            curRes.setX(x);
            curRes.setY(y);
            licheng = formatDouble2(licheng);
            curRes.setLicheng(licheng);
            curQxc = formatDouble2(curQxc);
            curRes.setQuxianchang(curQxc);
            curList.add(curRes);
        }
        hqxResult yhRes = new hqxResult();
        yhRes.setId("YH");
        curQxc = hz - yh;
        xita = ((curQxc / 2) / r) * (180 / Math.PI);
        x = curQxc - ((Math.pow(curQxc, 5)) / (40 * Math.pow(r, 2) * Math.pow(xxx, 2)));
        y = (Math.pow(curQxc, 3)) / (6 * r * xxx);
        double yhx = x;
        double yhy = y;
        x = baoliu3wei(x);
        y = baoliu3wei(y);
        curQxc = formatDouble2(curQxc);
        yhRes.setX(x);
        yhRes.setY(y);
        yhRes.setLicheng(formatDouble2(yh));
        yhRes.setQuxianchang(curQxc);
        curList.add(yhRes);
        //yh-qz
        int yh_qz_n = (int) Math.floor((yh - qz) / interval);
        yh_qz_n += hz_yh_n;
        while(i<= yh_qz_n){
            hqxResult curRes = new hqxResult();
            String id = String.valueOf(i);
            curRes.setId(id);
            licheng -= interval;
            if(Math.abs(licheng - yh) < 5) {
                licheng -= interval;
            }
            curQxc += interval;
            xita = ((curQxc-xxx) / r) * (180 / Math.PI)+beita;
            x = m + r * Math.sin(Math.toRadians(xita));
            x = baoliu3wei(x);
            curRes.setX(x);
            y = P + r * (1 - Math.cos(Math.toRadians(xita)));
            y = baoliu3wei(y);
            licheng = formatDouble2(licheng);
            curRes.setLicheng(licheng);
            curRes.setY(y);
            curRes.setQuxianchang(curQxc);
            curList.add(curRes);
            i++;
        }
        zuobiaofangyang(curList,t,Math.toRadians(a),zhx,zhy,jdZyjiao1,r,xxx);
    }

    /**
     * 将传入数字转换为度分秒的字符串
     * @return
     */
    public static String toDu(double du , double fen, double miao) {
        return (int)du + "°" + (int)fen + "'" + (int)miao + "\"";
    }


    //上面那个方法用到的函数
    public static String transfer(double du) {
        int du1 = (int) du;

        double tp = (du - du1) * 60;

        int fen = (int) tp;

        int miao = (int)Math.abs(((tp - fen) * 60));

        return du1 + "°" + Math.abs(fen) + "'" + miao + "\"";

    }

    public static double formatDouble2(double d) {

        // 新方法，如果不需要四舍五入，可以使用RoundingMode.DOWN
        BigDecimal bg = new BigDecimal(d).setScale(2, RoundingMode.UP);


        return bg.doubleValue();
    }

    public static double baoliu3wei(double d) {

        // 新方法，如果不需要四舍五入，可以使用RoundingMode.DOWN
        BigDecimal bg = new BigDecimal(d).setScale(3, RoundingMode.UP);


        return bg.doubleValue();
    }
    public static void zuobiaofangyang(List<hqxResult> curList,double t, double a,double zhx,double zhy,double jdzhfwj,double r,double xxx) {
        int n = curList.size();
        List<hqxResult> newList = new ArrayList<>();
        double sina = Math.sin(a);
        double cosa = Math.cos(a);
        int i = 0;
        int hyi = 0;
        double hypj = 0;
        double hyqxc = 0;
        double yhpj = 0;
        double yhqxc = 0;
        double hzi = 0;
        int yhi = 0;
        boolean isT = false;
        while (i < n) {
            hqxResult newRes = curList.get(i);
            if(newRes.getId() == "HY") {
                hyi = i;
                hyqxc = newRes.getQuxianchang();
                hypj = hyqxc/(6*r);
            }
            if(newRes.getId() == "YH") {
                yhi = i;
                yhqxc = newRes.getQuxianchang();
                yhpj = yhqxc/(6*r);
            }
            if(newRes.getId() == "HZ") {
                hzi = i;
            }
            if(!isT) {
                if(newRes.getId() != "QZ") {
                    newList.add(newRes);
                    i++;
                } else {
                    isT = true;
                    newList.add(newRes);
                    i++;
                }
            } else {
                hqxResult Res = new hqxResult();
                Res.setId(newRes.getId());
                Res.setQuxianchang(newRes.getQuxianchang());
                Res.setLicheng(newRes.getLicheng());
                double x = newRes.getX();
                double y = newRes.getY();
                double resx = t*(1+cosa)-x*cosa-y*sina;
                double resy = t*sina - x*sina + y*cosa;
                Res.setX(resx);
                Res.setY(resy);
                newList.add(Res);
                i++;
            }
        }

        i = 0;
        while (i< n) {
            hqxResult s = newList.get(i);
            hcsResult curRes = new hcsResult();
            curRes.setId(s.getId());
            double qxc = s.getQuxianchang();
            qxc = formatDouble2(qxc);
            double x = s.getX();
            double y = s.getY();
            double newx = zhx + x*Math.cos(Math.toRadians(jdzhfwj)) - y*Math.sin(Math.toRadians(jdzhfwj));
            double newy = zhy + x*Math.sin(Math.toRadians(jdzhfwj)) + y*Math.cos(Math.toRadians(jdzhfwj));
            newx = baoliu3wei(newx);
            newy = baoliu3wei(newy);
            curRes.setX(newx);
            curRes.setY(newy);
            i++;
            hcsList.add(curRes);
        }
    }
    public static void transferall(List<hqxResult> curList,double t, double a,double zhx,double zhy,double jdzhfwj,double r,double xxx) {
        int n = curList.size();
        List<hqxResult> newList = new ArrayList<>();
        double sina = Math.sin(a);
        double cosa = Math.cos(a);
        int i = 0;
        int hyi = 0;
        double hypj = 0;
        double hyqxc = 0;
        double yhpj = 0;
        double yhqxc = 0;
        double hzi = 0;
        int yhi = 0;
        boolean isT = false;
        while (i < n) {
            hqxResult newRes = curList.get(i);
            if(newRes.getId() == "HY") {
                hyi = i;
                hyqxc = newRes.getQuxianchang();
                hypj = hyqxc/(6*r);
            }
            if(newRes.getId() == "YH") {
                yhi = i;
                yhqxc = newRes.getQuxianchang();
                yhpj = yhqxc/(6*r);
            }
            if(newRes.getId() == "HZ") {
                hzi = i;
            }
            if(!isT) {
                if(newRes.getId() != "QZ") {
                    newList.add(newRes);
                    i++;
                } else {
                    isT = true;
                    newList.add(newRes);
                    i++;
                }
            } else {
                hqxResult Res = new hqxResult();
                Res.setId(newRes.getId());
                Res.setQuxianchang(newRes.getQuxianchang());
                Res.setLicheng(newRes.getLicheng());
                double x = newRes.getX();
                double y = newRes.getY();
                double resx = t*(1+cosa)-x*cosa-y*sina;
                double resy = t*sina - x*sina + y*cosa;
                Res.setX(resx);
                Res.setY(resy);
                newList.add(Res);
                i++;
            }
        }
        //开始计算极坐标列表
        i = 0;
        while (i< n) {
            hqxResult s = newList.get(i);
            hjiResult curRes = new hjiResult();
            curRes.setId(s.getId());
            curRes.setLicheng(formatDouble2(s.getLicheng()));
            double qxc = s.getQuxianchang();
            qxc = formatDouble2(qxc);
            curRes.setQuxianchang(qxc);
            //double pj = (qxc/(2*r))*180/(Math.PI);
            double pj = 0;
            if(i < hyi) {
                pj = Math.pow(qxc,2)/(6*r*xxx)*(180/Math.PI);
            } else if(i>=hyi && i< hzi) {
                pj = ((qxc-hyqxc)/(2*r))*(180/Math.PI) + hypj;
            } else if(i>= hzi && i <yhi) {
                pj = Math.pow(qxc,2)/(6*r*xxx)*(180/Math.PI);
            } else if(i >= yhi) {
                pj = ((qxc-yhqxc)/(2*r))*(180/Math.PI) + yhpj;
            }
            curRes.setPianjiao(transfer(pj));
            double x = s.getX();
            double y = s.getY();
            double newx = zhx + x*Math.cos(Math.toRadians(jdzhfwj)) - y*Math.sin(Math.toRadians(jdzhfwj));
            double newy = zhy + x*Math.sin(Math.toRadians(jdzhfwj)) + y*Math.cos(Math.toRadians(jdzhfwj));
            newx = baoliu3wei(newx);
            newy = baoliu3wei(newy);
            curRes.setX(newx);
            curRes.setY(newy);
            i++;
            hjiList.add(curRes);
        }
    }
}
